// 移动端基础样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px; // 基准字体大小
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;

  /* 隐藏滚动条但保留滚动功能 */
  /* Webkit浏览器(Chrome, Safari, Edge) */
  &::-webkit-scrollbar {
    width: 0px;
    background: transparent;
  }

  /* Firefox浏览器 */
  scrollbar-width: none;

  /* IE浏览器 */
  -ms-overflow-style: none;
}

body {
  width: 100%;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f7f8fa;
  color: #323233;
  line-height: 1.5;

  /* 隐藏滚动条但保留滚动功能 */
  /* Webkit浏览器(Chrome, Safari, Edge) */
  &::-webkit-scrollbar {
    width: 0px;
    background: transparent;
  }

  /* Firefox浏览器 */
  scrollbar-width: none;

  /* IE浏览器 */
  -ms-overflow-style: none;
}

#app {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;

  /* 隐藏滚动条但保留滚动功能 */
  /* Webkit浏览器(Chrome, Safari, Edge) */
  &::-webkit-scrollbar {
    width: 0px;
    background: transparent;
  }

  /* Firefox浏览器 */
  scrollbar-width: none;

  /* IE浏览器 */
  -ms-overflow-style: none;
}

// 移动端安全区域适配
.safe-area-top {
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-left {
  padding-left: constant(safe-area-inset-left);
  padding-left: env(safe-area-inset-left);
}

.safe-area-right {
  padding-right: constant(safe-area-inset-right);
  padding-right: env(safe-area-inset-right);
}

// 移动端通用容器
.mobile-container {
  width: 100%;
  max-width: 100%;
  padding: 0 16px;
  margin: 0 auto;
}

.mobile-page {
  width: 100%;
  min-height: 100vh;
  background-color: #f7f8fa;
  
  &.has-navbar {
    padding-top: 46px; // Vant NavBar 高度
  }
  
  &.has-tabbar {
    padding-bottom: 50px; // Vant Tabbar 高度
  }
}

// 1px 边框解决方案
.hairline {
  position: relative;
  
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    border: 1px solid #ebedf0;
    border-radius: inherit;
    transform: scale(0.5);
    transform-origin: 0 0;
    pointer-events: none;
    box-sizing: border-box;
  }
}

.hairline-top {
  position: relative;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #ebedf0;
    transform: scaleY(0.5);
    transform-origin: 0 0;
  }
}

.hairline-bottom {
  position: relative;
  
  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #ebedf0;
    transform: scaleY(0.5);
    transform-origin: 0 100%;
  }
}

// 移动端布局工具类
.flex {
  display: flex;
  
  &.flex-center {
    align-items: center;
    justify-content: center;
  }
  
  &.flex-between {
    align-items: center;
    justify-content: space-between;
  }
  
  &.flex-around {
    align-items: center;
    justify-content: space-around;
  }
  
  &.flex-column {
    flex-direction: column;
  }
  
  &.flex-wrap {
    flex-wrap: wrap;
  }
}

// 文本工具类
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

// 间距工具类
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ml-8 { margin-left: 8px; }
.ml-16 { margin-left: 16px; }
.mr-8 { margin-right: 8px; }
.mr-16 { margin-right: 16px; }

.pt-8 { padding-top: 8px; }
.pt-16 { padding-top: 16px; }
.pt-24 { padding-top: 24px; }
.pb-8 { padding-bottom: 8px; }
.pb-16 { padding-bottom: 16px; }
.pb-24 { padding-bottom: 24px; }
.pl-8 { padding-left: 8px; }
.pl-16 { padding-left: 16px; }
.pr-8 { padding-right: 8px; }
.pr-16 { padding-right: 16px; }

// 字体大小工具类
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }

// 字体颜色工具类
.text-primary { color: #1989fa; }
.text-success { color: #07c160; }
.text-danger { color: #ee0a24; }
.text-warning { color: #ff976a; }
.text-muted { color: #969799; }
.text-dark { color: #323233; }

// 背景色工具类
.bg-white { background-color: #fff; }
.bg-gray { background-color: #f7f8fa; }
.bg-primary { background-color: #1989fa; }
.bg-success { background-color: #07c160; }
.bg-danger { background-color: #ee0a24; }

// 圆角工具类
.rounded-sm { border-radius: 4px; }
.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-full { border-radius: 50%; }

// 阴影工具类
.shadow-sm {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.shadow {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

// 移动端特定样式
.mobile-input {
  font-size: 16px; // 防止 iOS 缩放
}

.mobile-button {
  min-height: 44px; // iOS 推荐的最小触摸区域
}

// 页面过渡动画
.page-enter-active,
.page-leave-active {
  transition: all 0.3s ease;
}

.page-enter-from {
  opacity: 0;
  transform: translateX(100%);
}

.page-leave-to {
  opacity: 0;
  transform: translateX(-100%);
}

// 滑动切换动画
.slide-enter-active,
.slide-leave-active {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide-enter-from {
  transform: translateX(100%);
}

.slide-leave-to {
  transform: translateX(-100%);
}

// 淡入淡出动画
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

// 底部安全区域适配（适用于有 tabbar 的页面）
.tabbar-safe-area {
  padding-bottom: calc(50px + constant(safe-area-inset-bottom));
  padding-bottom: calc(50px + env(safe-area-inset-bottom));
}

// 加载状态样式
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #969799;
}

// 空状态样式
.empty-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #969799;
  
  .empty-image {
    width: 120px;
    height: 120px;
    margin-bottom: 16px;
  }
  
  .empty-text {
    font-size: 14px;
    line-height: 20px;
  }
}

// 金额显示样式
.amount-text {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-weight: 500;
  
  &.positive {
    color: #07c160;
  }
  
  &.negative {
    color: #ee0a24;
  }
  
  &.zero {
    color: #969799;
  }
}

// 状态标签样式
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  
  &.success {
    color: #07c160;
    background-color: rgba(7, 193, 96, 0.1);
  }
  
  &.warning {
    color: #ff976a;
    background-color: rgba(255, 151, 106, 0.1);
  }
  
  &.danger {
    color: #ee0a24;
    background-color: rgba(238, 10, 36, 0.1);
  }
  
  &.info {
    color: #1989fa;
    background-color: rgba(25, 137, 250, 0.1);
  }
}

// 响应式断点（虽然主要是移动端，但保留一些基本的响应式）
@media (max-width: 320px) {
  .mobile-container {
    padding: 0 12px;
  }
}

@media (min-width: 768px) {
  .mobile-container {
    max-width: 375px;
    margin: 0 auto;
  }
}